<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page isELIgnored="false" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>知识荟</title>
    <link rel="stylesheet" href="../css/space-search.css" />
    <script type="text/javascript" src="../js/top.js"></script>
<body>
<!--**************顶部导航****************-->
<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2020/5/28
  Time: 15:00
  To change this template use File | Settings | File Templates.
--%>
<div class="nav">
    <div class="nav-left">
        <img src="../images/2.png" />
        <ul>
            <li class="margin"><a href="#">社区</a></li>
            <li><a href="/index/main?id=${user.id}">学习空间</a></li>
            <li class="margin"><a href="#">我的群组</a></li>
        </ul>
    </div>
    <div class="nav-right">
        <button id="button2">意见反馈</button>
        <!--头像-->
        <div  class="nav-right-logo">
            <div id="menu_title1" class="menu_title" onclick="openMenu(this)">
                <img src="../images/${user.userLogo}.jpg" />
                <div class="indicator" id="indicator1">
                    <
                </div>
            </div>
            <div class="menu" id="menu1">
                <hr>
                <div class="item">
                    <c:set var="user" value="${sessionScope.user}"/>
                    <h2>${user.username}</h2>
                </div>
                <div class="item">
                    <a href="/users/user-dongtai?id=${user.id}">我的动态</a>
                </div>
                <li class="item_divider"></li>
                <div class="item">
                    <a href="/users/user-personal-center?id=${user.id}">个人中心</a>
                </div>
                <div class="item">
                    <a href="/users/user-update-password?id=${user.id}">修改密码</a>
                </div>
                <hr>
                <div class="item">
                    <a href="/users/tuichu">退出系统</a>
                </div>
            </div>
        </div>
        <!--消息提示-->
        <div class="nav-right-img">
            <ul>
                <li>
                    <a href="#"><img src="../images/3.png" /></a>
                    <ul>
                        <li><a>回复我的</a></li>
                        <li><a>收到的赞</a></li>
                        <li><a>系统通知</a></li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
</div>
<!--**********************************************--->
<div class="bottom">
    <!--标题导航-->
    <div class="bottom-nav">
        <span class="nav-title-bottom"><h2>搜索</h2></span>
    </div>
    <!--选择-->
    <h3 class="search">你想搜索什么呢？</h3>
    <div>
        <form action="/space/search">
            <input type="text" placeholder="搜索资源或话题" class="el-input__inner" name="title" value="${title}"/>
            <input type="submit" value="搜索" class="search1">
        </form>
    </div>
    <div class="tab">
        <!--搜索资源-->
        <div>
            <input type="radio" id="r-1" name="tab" checked>
            <label for="r-1" class="label-1">资源</label>
            <div class="mod-1">
                <c:set var="user" value="${sessionScope.user}"/>
                <div class="top">
                    <ul>
                        <c:forEach items="${res}" var="r">
                            <li>
                                <div class="item">
                                    <div class="item-left">
                                        <span class="item-title"><a href="/resource/space-resourceShow?id=${r.id}&space_id=${r.space.id}">${r.title}</a></span>
                                        <span class="item-writer"><a href="/users/user-dongtai?id=${r.user.id}">${r.user.username}</a></span>
                                        <span class="item-space"><a href="/space/spacename?userId=${r.user.id}&name=${r.space.name}&space_id=${r.space.id}">${r.space.name}</a></span>
                                    </div>
                                    <div class="item-right">
                                        <span class="time">更新于 <fmt:formatDate value="${r.updatetime}" pattern='yyyy年MM月dd日 HH:mm:ss'/></span>
                                    </div>
                                </div>
                            </li>
                        </c:forEach>
                    </ul>
                </div>
            </div>
            <!--搜索话题-->
            <div>
                <input type="radio" id="r-2" name="tab">
                <label for="r-2" class="label-2">话题</label>
                <div class="mod-2">
                    <div class="top">
                        <ul>
                            <c:forEach var="discuss" items="${discuss}">
                                <li>
                                    <div class="item">
                                        <div class="item-left">
                                            <span class="item-title"><a href="/discuss/discuss-space-search?id=${discuss.id}&space_id=${discuss.space.id}">${discuss.title}</a></span>
                                            <span class="item-writer"><a href="/users/user-dongtai?id=${discuss.user.id}">${discuss.user.username}</a></span>
                                            <span class="item-space"><a href="/space/spacename?userId=${discuss.user.id}&name=${discuss.space.name}&space_id=${discuss.space.id}">${discuss.space.name}</a></span>
                                        </div>
                                        <div class="item-right">
                                            <span class="time">创建于 <fmt:formatDate value="${discuss.createdate}" pattern='yyyy年MM月dd日 HH:mm:ss'/></span>
                                        </div>
                                    </div>
                                </li>
                            </c:forEach>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>
